About this Article Article

This article covers the following platforms

Delphi |  Free Pascal

More Articles about RemObjects SDK

RO00 - Article ROadmap for the...

RO01 - RemObjects SDK Overview

RO04 - Mega Demo

RO05 - How to Write a RemObjects SDK...

RO06 - How to Write a RemObjects SDK...

RO07 - Smart Services™

RO08 - Smartening our First Server

RO09 - RemObjects 2.0 Session Managers

RO10 - Stop Calling Me So Often:...

RO11 - Building Asynchronous Clients...

RO12 - Consuming an Existing SOAP Based...

RO13 - Smart Project: Creating Scalable...

RO14 - Introducing the DiscoveryClient...

RO15 - Behind the Scenes: Inside...

RO16 - Class Factories Overview

RO17 - Manipulation of RODL Meta Data

RO18 - RODL - The Service Description...

RO19 - DataSnap Integration Pack

RO20 - How to Write a Service Using...

RO21 - Simple DataSnap Servers without...

RO24 - Creating Custom Project Templates

RO25 - Understanding the Client Side

RO27 - RemObjects 3.0 SDK Preview

RO28 - Using RemObjects SDK from COM

RO29 - Using the Service Tester

RO31 - Code level features of the...

RO33 - SSL/TLS for RemObjects SDK

RO34 - I Cannot ROmember

RO35 - ROCalc service

RO36 - Multicast Events in RemObjects...

RO37 – The New Super Channels

RO38 - Comparison of the RemObjects SDK...

RO39 - Applying updates to multiple...

RO40 - Support for XML-RPC

RO41 - Update standard .NET event...

RO42 - Introduction to Free Pascal...

RO45 - How to Write a RemObjects SDK...

RO46 - How to Write a RemObjects SDK...

WP02 - Cross Platform Development with...

Articles for this product are grouped in:

Ready for 'Vinci'

Introduction

First Steps

Smart Services

Interoperability

Architecture

Intermediate

Advanced

Tools

Contributions

DataSnap

Whitepaper

Update Pending

Legacy

Search Articles


Advanced Search...

RO42 - Introduction to Free Pascal support

The RemObjects SDK 'Vinci' release contains the first support for Free Pascal as an additional platform for the Delphi edition.

Free Pascal is a Delphi compatible Pascal Compiler for amongst others:

  • 32 bit Windows
  • 64bits Windows
  • Linux platforms.

Important note: Initially, the support is for the Free Pascal Compiler (FPC). We plan to add support for the Lazarus IDE in one of the bi-monthly updates to the RemObjects SDK, and this article will then be updated appropriately. However, as this article illustrates, it is already possible to use the Delphi IDE to create Free Pascal servers.

Pre-requisites

For this article, it is assumed that you have some knowledge of creating RemObjects SDK servers and clients. If not, see these articles first:

  • RO05 - How to Write a RemObjects SDK Server (Delphi Version)
  • RO06 - How to Write a RemObjects SDK Client (Delphi Version)
  • RO25 - Understanding the Client Side

To perform the steps presented in this article, you will need to install the the following:

  • Free Pascal from http://www.freepascal.org.
  • Free Pascal port of Indy from http://www.indyproject.org/Sockets/fpc/index.en.aspx
  • The RemObjects SDK - 'Vinci' version or later.

Example

As implied above, we'll create an application in Delphi, for subsequent deployment under Linux.

The first step is to create a new Command Line Server application:

The command line server is a command line based Server application that can easily be compiled in Free Pascal. We'll follow the wizard and use the default options. Next, we open the Service Builder by clicking the RemObjects SDK | Edit Service Library menu item. By default, the wizard adds a new service and two methods. For this article, we'll use these methods to show the Free Pascal support.

Close the Service Builder and build the application. A wizard will display asking for the kind of service to create:

The first option: "Simple Object" is the one that requires the least changes under Free Pascal, so we'll choose that. The wizard will create a unit with implementations for the Sum and GetServiceTime methods. We'll add a simple 'Result := a + b' for the Sum method and 'Result := Now' for the GetServerTime method.

That's it! Save all files and the Delphi IDE can be closed.

Prepare for Free Pascal Use

A few simple steps are all that is required:

First, rename the .dpr file to .pas and open the server in the Free Pascal console IDE (FP). Next, add RemObjects SDK and Indy to the 'Units' tab:

For the 'Include Files' tab, only 'RemObjects SDK for Delphi\Source' is needed.

Finally, when running on Windows, you will need the precompiled ZLib1.dll from http://www.zlib.net in the path to run the application. On most UNIX derivatives, this will already be installed.

That’s all. Press Ctrl+F9 to run the server:

You can now use this service from Free Pascal, Delphi or .NET, like you would for any kind of service. The instructions above showed Windows for the Free Pascal part, but the instructions are exactly the same when running Free Pascal on Linux.